%ifndef SYMBOL_ASM
%define SYMBOL_ASM

%include "syscalls.asm"
%include "symbol_table.asm"

section .data

err3_1_ty	db	"ERROR 3. SYMBOL OOB."
err3_1_len:

section .text

display_symbol:
	mov	r8, 0b000
	call	type_check
	
	shr	rax, 5
	
	cmp	rax, [symbol_table_len]
	jge	.oobs
		
	mov	rsi, [symbol_table + 8*rax]
	mov	rdx, [symbol_len_table + 8*rax]
	movzx	rdx, byte [rdx]
	mov	rax, sys_write
	mov	rdi, 1
	syscall

	ret

.oobs:
	mov	rax, sys_write
	mov	rdi, 0
	mov	rsi, err3_1_ty
	mov	rdx, (err3_1_len - err3_1_ty)
	syscall
	
	call	nl
	
	mov	rax, sys_exit
	mov	rdi, 1
	syscall

%endif
